<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('warehouse_ins', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('company_id')->default(0)->index();
            $table->unsignedBigInteger('project_id')->default(0)->index();
            $table->unsignedBigInteger('admin_id')->default(0)->index();
            $table->unsignedBigInteger('warehouse_id')->default(0)->index();
            $table->string('name')->nullable()->comment('材料名称');
            $table->string('encoding')->nullable()->comment('材料编码');
            $table->string('type')->nullable()->comment('材料类别');
            $table->string('number')->nullable()->comment('材料编号');
            $table->decimal('price')->nullable()->comment('金额');
            $table->string('specification')->nullable()->comment('规格');
            $table->string('brand')->nullable()->comment('品牌');
            $table->string('unit')->nullable()->comment('单位');
            $table->string('applicant')->nullable()->comment('申请人');
            $table->string('data_cleaning')->nullable()->comment('清标');
            $table->integer('quantity')->nullable()->comment('数量');
            $table->string('delivery_note_number')->nullable()->comment('送货单编号');
            $table->decimal('unit_price')->nullable()->comment('单价');
            $table->string('acceptance_photos',3000)->nullable()->comment('验收照片带水印');
            $table->string('delivery_note_photo',3000)->nullable()->comment('送货照片带水印');
            $table->string('inspector')->nullable()->comment('验收人');
            $table->date('delivery_date')->nullable()->comment('送货日期');
            $table->string('application_number')->nullable()->comment('申请单编号');
            $table->string('delivery_unit')->nullable()->comment('送货单位');
            $table->tinyInteger('status')->default(0)->comment('是否已经入库（0-否，1-是）');
            $table->string('remarks')->nullable()->comment('备注');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('warehouse_ins');
    }
};
